home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 2000 July: Mac OS SDK / Dev.CD Jul 00 SDK2.toast / Development Kits / Hardware / PC Card SDKs / PC Card Manager 3.0 / CIncludes / PCCardTuples.h < prev    next >
Encoding:
C/C++ Source or Header  |  1997-06-05  |  13.6 KB  |  436 lines  |  [TEXT/MPS ]

  1. /*
  2.      File:        PCCardTuples.h
  3.  
  4.      Contains:    List of PCMCIA tuple types and definitions of tuple contents.
  5.  
  6.      Version:    System 7.5
  7.  
  8.      DRI:        Dave Falkenburg
  9.  
  10.      Copyright:    © 1984-1996 by Apple Computer, Inc.
  11.                  All rights reserved.
  12.  
  13.      Warning:    *** APPLE INTERNAL USE ONLY ***
  14.                  This file may contain unreleased API's
  15.  
  16.      BuildInfo:    Built by:            Dave Falkenburg
  17.                  With Interfacer:    2.0d13   (PowerPC native)
  18.                  From:                PCCardTuples.i
  19.                      Revision:        9
  20.                      Dated:            9/23/96
  21.                      Last change by:    DRF
  22.                      Last comment:    TPLFID_VideoAdaptor -> TPLFID_VideoAdapter;
  23.  
  24.      Bugs:        Report bugs to Radar component “System Interfaces”, “Latest”
  25.                  List the version information (from above) in the Problem Description.
  26.  
  27. */
  28. #ifndef __PCCARDTUPLES__
  29. #define __PCCARDTUPLES__
  30.  
  31. #ifndef __TYPES__
  32. #include <Types.h>
  33. #endif
  34.  
  35. #ifdef __cplusplus
  36. extern "C" {
  37. #endif
  38.  
  39. #if PRAGMA_IMPORT_SUPPORTED
  40. #pragma import on
  41. #endif
  42.  
  43. #if PRAGMA_ALIGN_SUPPORTED
  44. #pragma options align=mac68k
  45. #endif
  46.  
  47.  
  48. enum {
  49.     MAX_TUPLE_SIZE                = 256
  50. };
  51.  
  52. /*
  53. ————————————————————————————————————————————————————————————————————————
  54.     Defines for Tuple codes
  55. ————————————————————————————————————————————————————————————————————————
  56. */
  57.  
  58. enum {
  59.     CISTPL_NULL                    = 0x00,
  60.     CISTPL_DEVICE                = 0x01,
  61.     CISTPL_LONGLINK_CB            = 0x02,
  62.     CISTPL_INDIRECT                = 0x03,
  63.     CISTPL_CONFIG_CB            = 0x04,
  64.     CISTPL_CFTABLE_ENTRY_CB        = 0x05,
  65.     CISTPL_LONGLINK_MFC            = 0x06,
  66.     CISTPL_BAR                    = 0x07,
  67.     CISTPL_CHECKSUM                = 0x10,
  68.     CISTPL_LONGLINK_A            = 0x11,
  69.     CISTPL_LONGLINK_C            = 0x12,
  70.     CISTPL_LINKTARGET            = 0x13,
  71.     CISTPL_NO_LINK                = 0x14,
  72.     CISTPL_VERS_1                = 0x15,
  73.     CISTPL_ALTSTR                = 0x16,
  74.     CISTPL_DEVICE_A                = 0x17,
  75.     CISTPL_JEDEC_C                = 0x18,
  76.     CISTPL_JEDEC_A                = 0x19,
  77.     CISTPL_CONFIG                = 0x1A,
  78.     CISTPL_CFTABLE_ENTRY        = 0x1B,
  79.     CISTPL_DEVICE_OC            = 0x1C,
  80.     CISTPL_DEVICE_OA            = 0x1D,
  81.     CISTPL_DEVICE_GEO            = 0x1E,
  82.     CISTPL_DEVICE_GEO_A            = 0x1F,
  83.     CISTPL_MANFID                = 0x20,
  84.     CISTPL_FUNCID                = 0x21,
  85.     CISTPL_FUNCE                = 0x22,
  86.     CISTPL_SWIL                    = 0x23,
  87.     CISTPL_VERS_2                = 0x40,
  88.     CISTPL_FORMAT                = 0x41,
  89.     CISTPL_GEOMETRY                = 0x42,
  90.     CISTPL_BYTEORDER            = 0x43,
  91.     CISTPL_DATE                    = 0x44,
  92.     CISTPL_BATTERY                = 0x45,
  93.     CISTPL_ORG                    = 0x46,
  94.     CISTPL_VENDOR                = 0xFE,
  95.     CISTPL_END                    = 0xFF
  96. };
  97.  
  98. /*
  99. ————————————————————————————————————————————————————————————————————————
  100.     Tuple Data Block Definitions
  101. ————————————————————————————————————————————————————————————————————————
  102. */
  103. /*------------    Device Information Tuple (01H, 17H)    -----------                            */
  104. struct DeviceIDTuple {
  105.     Byte                             TPLDEV_TYPE_WPS_SPEED;        /* Device Type Code: 7-4, WPS: 3,  Device Speed: 2-0*/
  106.     Byte                             deviceData[253];
  107. };
  108. typedef struct DeviceIDTuple DeviceIDTuple;
  109.  
  110.  
  111. enum {
  112.     TPLDEV_TYPE_MASK            = 0xF0,                            /* device type mask for TPLDEV_TYPE_WPS_SPEED*/
  113.     TPLDEV_TYPE_EXTENDED        = 0xE0,                            /* device type value for extended type*/
  114.     TPLDEV_WPS_MASK                = 0x08,                            /* write-protect switch mask for TPLDEV_TYPE_WPS_SPEED*/
  115.     TPLDEV_SPEED_MASK            = 0x07,                            /* device speed mask for TPLDEV_TYPE_WPS_SPEED*/
  116.     TPLDEV_DSPEED_NULL            = 0x00,                            /* speed for null device type*/
  117.     TPLDEV_DSPEED_250NS            = 0x01,                            /* 250ns card access time*/
  118.     TPLDEV_DSPEED_200NS            = 0x02,                            /* 200ns card access time*/
  119.     TPLDEV_DSPEED_150NS            = 0x03,                            /* 150ns card access time*/
  120.     TPLDEV_DSPEED_100NS            = 0x04,                            /* 100ns card access time*/
  121.     TPLDEV_EXTENDED_SPEED        = 0x07,                            /* device speed value for extended speed*/
  122.     TPLDEV_SPEED_EXPONENT        = 0x07,                            /* extended byte exponent mask*/
  123.     TPLDEV_SPEED_MANTISSA        = 0x78,                            /* extended byte mantissa mask*/
  124.     TPLDEV_SPEED_EXTENDED_MASK    = 0x80                            /* bit set if more extended speed data follows*/
  125. };
  126.  
  127. /*    device ID types*/
  128.  
  129. enum {
  130.     DTYPE_NULL                    = 0,
  131.     DTYPE_ROM                    = 1,
  132.     DTYPE_OTPROM                = 2,
  133.     DTYPE_EPROM                    = 3,
  134.     DTYPE_EEPROM                = 4,
  135.     DTYPE_FLASH                    = 5,
  136.     DTYPE_SRAM                    = 6,
  137.     DTYPE_DRAM                    = 7,
  138.     DTYPE_FUNCSPEC                = 0x0D,
  139.     DTYPE_EXTEND                = 0x0E
  140. };
  141.  
  142. /*---------------    Checksum Control Tuple (10H)    ---------------                            */
  143. struct ChecksumControlTuple {
  144.     short                             TPLCKS_ADDR;                /* offset to region to be checksummed, LSB first*/
  145.     short                             TPLCKS_LEN;                    /* length of region to be checksummed, LSB first*/
  146.     char                             TPLCKS_CS;                    /* checksum of the region*/
  147.     Byte                             reserved;                    /* padding*/
  148. };
  149. typedef struct ChecksumControlTuple ChecksumControlTuple;
  150.  
  151. /*----------------    Long Link Multi-Function Tuple (06H)    ------                    */
  152. struct LongLinkMFCTuple {
  153.     UInt8                             TPLMFC_NUM;                    /* Number of sets of config registers for individual functions*/
  154.  
  155.     UInt8                             TPLMFC_TAS1;                /* CIS target address space for first function (00 = Attr, 01 = Common)*/
  156.     UInt32                             TPLMFC_ADDR1;                /* Target address of first CIS, unsigned long, lsb first*/
  157.  
  158.     UInt8                             TPLMFC_TAS2;                /* CIS target address space for second function (00 = Attr, 01 = Common)*/
  159.     UInt8                             TPLMFC_ADDR2[4];            /* [MISALIGNED!] Target address of second CIS, unsigned long, lsb first*/
  160.  
  161.                                                                 /* the following fields are of undetermined length and should be calculated at runtime*/
  162.                                                                 /* */
  163.                                                                 /* UInt8        TPLMFC_TASn;*/
  164.                                                                 /* UInt32        TPLMFC_ADDRn;*/
  165. };
  166. typedef struct LongLinkMFCTuple LongLinkMFCTuple;
  167.  
  168. /*----------------    Long Link Tuple (11H, 12H)    ----------------                            */
  169. struct LongLinkTuple {
  170.     UInt32                             TPLL_ADDR;                    /* target address, LSB first*/
  171. };
  172. typedef struct LongLinkTuple LongLinkTuple;
  173.  
  174. /*-----------------    Link Target Tuple (13H)    ------------------                            */
  175. struct LinkTargetTuple {
  176.     Byte                             TPLL_TAG[3];                /* tag: should be 'C', 'I', 'S'*/
  177. };
  178. typedef struct LinkTargetTuple LinkTargetTuple;
  179.  
  180. /*----------------    Level 1 Version Tuple (15H)    ---------------                            */
  181. struct Level1VersionTuple {
  182.     Byte                             TPLLV1_MAJOR;                /* major version number (0x04)*/
  183.     Byte                             TPLLV1_MINOR;                /* minor version number (0x01 for release 2.0 and 2.01)*/
  184.     Byte                             TPLLV1_INFO[1];                /* product information string, zero-terminated*/
  185. };
  186. typedef struct Level1VersionTuple Level1VersionTuple;
  187.  
  188. /*-------------    JEDEC Identifier Tuple (18H, 19H)    ------------                            */
  189. struct JEDECDeviceInfo {
  190.     Byte                             manufacturerID;
  191.     Byte                             manufacturerInfo;
  192. };
  193. typedef struct JEDECDeviceInfo JEDECDeviceInfo;
  194.  
  195. struct JEDECIdentifierTuple {
  196.     JEDECDeviceInfo                 device[1];
  197. };
  198. typedef struct JEDECIdentifierTuple JEDECIdentifierTuple;
  199.  
  200. /*---------    Configuration Tuple (1AH)    ----------                            */
  201. struct ConfigTuple {
  202.     Byte                             TPCC_SZ;                    /* size of fields byte*/
  203.     Byte                             TPCC_LAST;                    /* index number of last config entry*/
  204.     Byte                             TPCC_RADR;                    /* config reg's base addr in reg. space*/
  205.     Byte                             reserved;                    /* padding*/
  206.  
  207.                                                                 /* the following fields are of undetermined length and should be calculated at runtime*/
  208.                                                                 /*UInt32            TPCC_RMSK;*/
  209.                                                                 /*UInt32            TPCC_RSVD;*/
  210.                                                                 /*UInt32            TPCC_SBTPL;*/
  211. };
  212. typedef struct ConfigTuple ConfigTuple;
  213.  
  214. /*    TPCC_RADR field definitions*/
  215.  
  216. enum {
  217.     TPCC_RASZ                    = 0x03,                            /* bits 1-0*/
  218.     TPCC_RMSZ                    = 0x3C,                            /* bits 5-2*/
  219.     TPCC_RFSZ                    = 0xC0                            /* bits 7-6*/
  220. };
  221.  
  222. /*---------    Device Geometry Tuple (1EH, 1FH)    ----------*/
  223. struct DeviceGeometry {
  224.     UInt8                             DGTPL_BUS;                    /* system bus width = 2^(n-1), n>0*/
  225.     UInt8                             DGTPL_EBS;                    /* erase block size = 2^(n-1), n>0*/
  226.     UInt8                             DGTPL_RBS;                    /* read block size = 2^(n-1), n>0*/
  227.     UInt8                             DGTPL_WBS;                    /* write block size = 2^(n-1), n>0*/
  228.     UInt8                             DGTPL_PART;                    /* partitioning size = 2^(n-1), n>0*/
  229.     UInt8                             DGTPL_HWIL;                    /* hardware interleave = 2^(n-1), n>0*/
  230. };
  231. typedef struct DeviceGeometry DeviceGeometry;
  232.  
  233. struct DeviceGeometryTuple {
  234.     DeviceGeometry                     device[42];
  235. };
  236. typedef struct DeviceGeometryTuple DeviceGeometryTuple;
  237.  
  238. /*---------    Manufacturer Identification Tuple (20H)    ----------                            */
  239. struct ManufIDTuple {
  240.     short                             TPLMID_MANF;                /* PCMCIA PC Card manufacturer code*/
  241.     short                             TPLMID_CARD;                /* manufacturer information (part number and/or revision)*/
  242. };
  243. typedef struct ManufIDTuple ManufIDTuple;
  244.  
  245. /*-----------    Function Identification Tuple (21H)    ------------                            */
  246. struct FunctionIDTuple {
  247.     Byte                             TPLFID_FUNCTION;            /* PC card function code*/
  248.     Byte                             TPLFID_SYSINIT;                /* system initialization bit mask*/
  249. };
  250. typedef struct FunctionIDTuple FunctionIDTuple;
  251.  
  252. /*    function codes*/
  253.  
  254. enum {
  255.     TPLFID_MultiFunction        = 0,
  256.     TPLFID_Memory                = 1,
  257.     TPLFID_SerialPort            = 2,
  258.     TPLFID_ParallelPort            = 3,
  259.     TPLFID_FixedDisk            = 4,
  260.     TPLFID_VideoAdapter            = 5,
  261.     TPLFID_NetworkLANAdapter    = 6,
  262.     TPLFID_AIMS                    = 7,
  263.     TPLFID_SCSI                    = 8,
  264.     TPLFID_Security                = 9
  265. };
  266.  
  267. /*------------    Software Interleave Tuple (23H)    ---------------                            */
  268. struct SoftwareInterleaveTuple {
  269.     char                             TPLSWIL_INTRLV;                /* software interleave*/
  270. };
  271. typedef struct SoftwareInterleaveTuple SoftwareInterleaveTuple;
  272.  
  273. /*-------    Level 2 Version and Information Tuple (40H)    --------                            */
  274. struct Level2VersionTuple {
  275.     Byte                             TPLLV2_VERS;                /* structure version (0x00)*/
  276.     Byte                             TPLLV2_COMPLY;                /* level of compliance with the standard (0x00)*/
  277.     UInt16                             TPLLV2_DINDEX;                /* byte address of first data byte in card, LSB first*/
  278.     Byte                             TPLLV2_RSV6;                /* reserved, must be zero*/
  279.     Byte                             TPLLV2_RSV7;                /* reserved, must be zero*/
  280.     Byte                             TPLLV2_VSPEC8;                /* vendor specific byte*/
  281.     Byte                             TPLLV2_VSPEC9;                /* vendor specific byte*/
  282.     char                             TPLLV2_NHDR;                /* number of copies of CIS present on this device*/
  283.     char                             TPLLV2_OEM[1];                /* vendor of software that formatted card, zero-terminated*/
  284.     char                             TPLLV2_INFO[1];                /* informational message about the card, zero-terminated*/
  285.     Byte                             reserved;                    /* padding*/
  286. };
  287. typedef struct Level2VersionTuple Level2VersionTuple;
  288.  
  289. /*
  290. --------------------    Format Tuple (41H)    --------------------                            
  291.  additional information for disk type:
  292. */
  293. struct FormatDiskTuple {
  294.     UInt16                             TPLFMT_BKSZ;                /*    block size, or zero if unblocked format*/
  295.     UInt32                             TPLFMT_NBLOCKS;                /*    number of data blocks in this partition*/
  296.     UInt32                             TPLFMT_EDCLOC;                /*    location of error detection code, or zero if interleaved*/
  297. };
  298. typedef struct FormatDiskTuple FormatDiskTuple;
  299.  
  300. /* additional information for disk type:*/
  301. struct FormatMemTuple {
  302.     Byte                             TPLFMT_FLAGS;                /*    various flags*/
  303.     Byte                             TPLFMT_RESERVED;            /*    reserved, set to zero*/
  304.     UInt32                             TPLFMT_ADDRESS;                /*    physical location at which this memory partion must be mapped*/
  305.     UInt32                             TPLFMT_EDCLOC;                /*    location of error detection code, or zero if interleaved*/
  306. };
  307. typedef struct FormatMemTuple FormatMemTuple;
  308.  
  309. struct FormatTuple {
  310.     char                             TPLFMT_TYPE;                /* format type code*/
  311.     char                             TPLFMT_EDC;                    /* error detection method and length of error detection code*/
  312.     long                             TPLFMT_OFFSET;                /* offset to first data byte in this partition*/
  313.     long                             TPLFMT_NBYTES;                /* number of data bytes in this partition*/
  314.     union {
  315.         FormatDiskTuple                 TPLFMT_DISK;
  316.         FormatMemTuple                     TPLFMT_MEM;
  317.     }                                 u;
  318. };
  319. typedef struct FormatTuple FormatTuple;
  320.  
  321. /*    format types*/
  322.  
  323. enum {
  324.     TPLFMTTYPE_DISK                = 0,
  325.     TPLFMTTYPE_MEM                = 1,
  326.     TPLFMTTYPE_VS                = 0x80
  327. };
  328.  
  329. /*    error detection types*/
  330.  
  331. enum {
  332.     TPLFMTEDC_NONE                = 0,
  333.     TPLFMTEDC_CKSUM                = 1,
  334.     TPLFMTEDC_CRC                = 2,
  335.     TPLFMTEDC_PCC                = 3,
  336.     TPLFMTEDC_VS                = 8
  337. };
  338.  
  339. /*    bits in TPLFMT_FLAGS*/
  340.  
  341. enum {
  342.     TPLFMTFLAGS_ADDR            = 0,
  343.     TPLFMTFLAGS_AUTO            = 1
  344. };
  345.  
  346. /*------------------    Geometry Tuple (42H)    --------------------                            */
  347. struct GeometryTuple {
  348.     char                             TPLGEO_SPT;                    /* number of sectors per track*/
  349.     char                             TPLGEO_TPC;                    /* number of tracks per cylinder*/
  350.     short                             TPLGEO_NCYL;                /* number of cylinders, total*/
  351. };
  352. typedef struct GeometryTuple GeometryTuple;
  353.  
  354. /*-----------------    Byte-Order Tuple (43H)    -------------------                            */
  355. struct ByteOrderTuple {
  356.     char                             TPLBYTE_ORDER;                /* byte order code*/
  357.     char                             TPLBYTE_MAP;                /* byte mapping code*/
  358. };
  359. typedef struct ByteOrderTuple ByteOrderTuple;
  360.  
  361. /*    byte order codes*/
  362.  
  363. enum {
  364.     TYPBYTEORD_LOW                = 0,
  365.     TYPBYTEORD_HIGH                = 1,
  366.     TYPBYTEORD_VS                = 0x80
  367. };
  368.  
  369. /*    byte mapping codes*/
  370.  
  371. enum {
  372.     TYPBYTEMAP_LOW                = 0,
  373.     TYPBYTEMAP_HIGH                = 1,
  374.     TYPBYTEMAP_VS                = 0x80
  375. };
  376.  
  377. /*----------    Card Initialization Date Tuple (44H)    ------------                            */
  378. struct CardInitDateTuple {
  379.     UInt16                             TPLDATE_TIME;                /* hours, minutes, seconds*/
  380.     UInt16                             TPLDATE_DAY;                /* year, month, day*/
  381. };
  382. typedef struct CardInitDateTuple CardInitDateTuple;
  383.  
  384. /*----------    Battery-Replacement Date Tuple (45H)    ------------                            */
  385. struct BatteryReplaceDateTuple {
  386.     UInt16                             TPLBATT_RDAY;                /* last replacement date (year, month, day)*/
  387.     UInt16                             TPLBATT_XDAY;                /* battery expiration date (year, month, day)*/
  388. };
  389. typedef struct BatteryReplaceDateTuple BatteryReplaceDateTuple;
  390.  
  391. /*----------------------    General Tuple    -----------------------                            */
  392. union TupleBody {
  393.     DeviceIDTuple                     deviceID;
  394.     ChecksumControlTuple             checksum;
  395.     LongLinkTuple                     link;
  396.     LinkTargetTuple                 target;
  397.     Level1VersionTuple                 level1;
  398.     JEDECIdentifierTuple             jedecID;
  399.     ConfigTuple                     config;
  400.     DeviceGeometryTuple             devGeo;
  401.     ManufIDTuple                     manufID;
  402.     FunctionIDTuple                 funcID;
  403.     SoftwareInterleaveTuple         swil;
  404.     Level2VersionTuple                 level2;
  405.     FormatTuple                     format;
  406.     GeometryTuple                     geometry;
  407.     ByteOrderTuple                     order;
  408.     CardInitDateTuple                 initDate;
  409.     BatteryReplaceDateTuple         battDate;
  410.     Byte                             tupleData[254];
  411. };
  412. typedef union TupleBody TupleBody;
  413.  
  414. struct Tuple {
  415.     Byte                             TPL_CODE;
  416.     Byte                             TPL_LINK;
  417.     TupleBody                         TPL_BODY;
  418. };
  419. typedef struct Tuple Tuple;
  420.  
  421.  
  422. #if PRAGMA_ALIGN_SUPPORTED
  423. #pragma options align=reset
  424. #endif
  425.  
  426. #if PRAGMA_IMPORT_SUPPORTED
  427. #pragma import off
  428. #endif
  429.  
  430. #ifdef __cplusplus
  431. }
  432. #endif
  433.  
  434. #endif /* __PCCARDTUPLES__ */
  435.  
  436.